from flask import Blueprint
from flask import redirect
from flask import request
from flask import session

admin_blu=Blueprint('admin',__name__,url_prefix='/admin')

from . import views

#  使用请求钩子对普通用户进行拦截
@admin_blu.before_request
def before_request():
    #  判断请求的是否是登陆页面
    if not request.url.endswith('/admin/login'):
        if not session.get('is_admin'):
            return redirect('/')

